using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class barbette000 : SkillBasic
{
    // Start is called before the first frame update
    public int face;
    public float CD;
    private float CDtime;
    Transform playertransform;
    GameObject playerobject;
    PlayerBasic player;
    public GameObject barbette;
    //public PlayerAttack playerattack;
    //private Rigidbody2D myRigidbody;
    void Start()
    {
        playertransform = GetComponentInParent<Transform>();
        player = GetComponentInParent<PlayerBasic>();
        BarbetteCD.CD = CD;
        BarbetteCD.CDCurrent = 0;
    }
    void Skill()
    {
        Vector3 position = playertransform.position;
        position.y += 1f;
        Instantiate(barbette, position, Quaternion.identity);
    }
    // Update is called once per frame
    void Update()
    {
        face = player.face;
        if (CDtime > 0)
        {
            CDtime -= Time.deltaTime;
            BarbetteCD.CDCurrent = CDtime;
        }
        if (Input.GetKeyDown(KeyCode)&&Time.timeScale>0)
        {
            if (CDtime <= 0)
            {
                Skill();
                CDtime = CD;
            }


        }
    }
}
